package com.glory.cqaospda.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.glory.cqaospda.R;
import com.glory.cqaospda.bean.QueryRepairInfoBean;

import java.util.List;

import androidx.annotation.Nullable;

public class RepairInfoAdapter extends BaseQuickAdapter<QueryRepairInfoBean.RepairList, BaseViewHolder> {

    private List<QueryRepairInfoBean.RepairList> datalist;

    public RepairInfoAdapter(@Nullable List<QueryRepairInfoBean.RepairList> data) {
        super(R.layout.adapter_repairinfo, data);
        datalist = data;
    }

    @Override
    protected void convert(BaseViewHolder helper, QueryRepairInfoBean.RepairList item) {
        String state = "";
        String priority = "";
        switch (item.getMState()){
            case "0":
                state = "待修";
                break;
            case "1":
                state = "维修";
                break;
        }
        switch (item.getMPriority()){
            case "0":
                priority = "高";
                break;
            case "1":
                priority = "中";
                break;
            case "2":
                priority = "低";
                break;
        }
        switch (item.getMRepairReason()){
            case "0":
                helper.setText(R.id.tvRepairReason, "维修");
                break;
            case "1":
                helper.setText(R.id.tvRepairReason, "改机");
                break;
            case "2":
                helper.setText(R.id.tvRepairReason, "工程借机");
                break;
            case "3":
                helper.setText(R.id.tvRepairReason, "其他");
                break;
        }
        helper.setText(R.id.tvOrderName, item.getMOrderName());
        helper.setText(R.id.tvLotQty, priority);
        helper.setText(R.id.tvState,state);
        helper.setText(R.id.tvEqpId,item.getMEqpID());
    }

}
